package com.itheima.controller;

import com.alibaba.dubbo.config.annotation.Reference;
import com.itheima.constant.MessageConstant;
import com.itheima.entity.Result;
import com.itheima.pojo.Intervention;
import com.itheima.service.InterventionService;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 健康干预
 */
@RestController
@RequestMapping("/intervention")
public class InterventionController {

    @Reference
    private InterventionService interventionService;

    @RequestMapping("/findByOrderId")
    public Result findByOrderId(Integer id){
        try {
            Intervention intervention = interventionService.findByOrderId(id);
            return new Result(true, MessageConstant.ADD_INTERVENTION_SUCCESS,intervention);
        }catch (Exception e){
            e.printStackTrace();
            return new Result(false, MessageConstant.ADD_INTERVENTION_FAIL);
        }
    }
}
